﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using VisualAgile.Model;

namespace VisualAgile.Web.Tests
{
    class FakeIterationData
    {
        public static List<Iteration> CreateTestIterations()
        {
            int start = 28;
            int end = 42;

            List<Iteration> iterations = new List<Iteration>() { 
                DefaultIteration(),
                DemoIteration()              
            };

            for (int i = 0; i < 10; i++)
            {
                Iteration sampleIteration = new Iteration()
                {
                    IterationID = Guid.NewGuid(),
                    ReleaseID = new Guid("2EBDBC36-3585-47b3-8709-BE3184956938"),
                    Name = "New Iteration",
                    PeriodFrom = DateTime.Now.AddDays(start + i),
                    PeriodTo = DateTime.Now.AddDays(end + i),
                    CreateTime = DateTime.Now
                };

                sampleIteration.AddStory(FakeStoryData.CreateTestStorys()[i]);

                iterations.Add(sampleIteration);

                start++;
                end++;
            }

            return iterations;
        }
        
        public static Iteration DemoIteration()
        {                        
            Iteration demo = new Iteration()
            {
                IterationID = new Guid("29DC7A46-52B5-4941-AAE2-F48592847E42"),
                ReleaseID = new Guid("29DC7A46-52B5-4941-AAE2-F48592847E42"),
                Name = "demo iteration",
                PeriodFrom = DateTime.Now,
                PeriodTo = DateTime.Now.AddDays(13), 
                CreateTime = DateTime.Now
            };

            FakeLabelData.CreateDemoLabels().ForEach(l => demo.AddLabel(l));

            demo.AddStory(FakeStoryData.DemoStory());

            return demo;
        }

        public static Iteration DefaultIteration()
        {
            Iteration Default = new Iteration()
            {
                IterationID = new Guid("BE4B0656-8685-439e-B4EA-66D5C9BA7508"),
                ReleaseID = new Guid("BE4B0656-8685-439e-B4EA-66D5C9BA7508"),
                Name = "default Iteration",
                PeriodFrom = DateTime.Now.AddDays(14),
                PeriodTo = DateTime.Now.AddDays(27), 
                CreateTime = DateTime.Now
            };

            FakeLabelData.CreateDefaultLabels().ForEach(l => Default.AddLabel(l));

            Default.AddStory(FakeStoryData.DefaultStory());

            return Default;
        }      
    }
}
